<?php

  session_start();
  include "config.php";
  include "ALcustomerEnquiryProblem.php";

  if(isset($_SESSION["user"]))
  {
    include "$header";
	include "$body";

  
?>

<div style="position:absolute; top:0px; left:1px; border:0;">
  <span class="page">Record Customer Enquiry Problem</span>
</div>

<?php

  include "$H_rcep";

	if(isset($_POST["submit"]))
    {
	  $staff_no = ltrim($_POST["staff_no"]);
      $enquiry_date = ltrim($_POST["enquiry_date"]);
      $prod_no = ltrim($_POST["prod_no"]);
      $description = ltrim($_POST["description"]);
      $quantity = ltrim($_POST["quantity"]);
	  $reason = ltrim($_POST["reason"]);
      $dep_no = ltrim($_POST["dep_no"]);
      $customer_name = ltrim($_POST["customer_name"]);
      $customer_no = ltrim($_POST["customer_no"]);
	
	  if(validateDetails($staff_no, $enquiry_date, $prod_no, $description, $quantity, $reason, $dep_no, $customer_name, $customer_no) == false)
      {
        showForm();
        echo "<SCRIPT language='Javascript'>";
        echo "  recordCustomerEnquiryProblem.staff_no.value='".$staff_no."';";
        echo "  recordCustomerEnquiryProblem.enquiry_date.value='".$enquiry_date."';";
        echo "  recordCustomerEnquiryProblem.prod_no.value='".$prod_no."';";
        echo "  recordCustomerEnquiryProblem.description.value='".$description."';";
        echo "  recordCustomerEnquiryProblem.quantity.value='".$quantity."';";
		echo "  recordCustomerEnquiryProblem.reason.options.selectedIndex=".$reason.";";
        echo "  recordCustomerEnquiryProblem.dep_no.options.selectedIndex=".$dep_no.";";
        echo "  recordCustomerEnquiryProblem.customer_name.value='".$customer_name."';";
        echo "  recordCustomerEnquiryProblem.customer_no.value='".$customer_no."';";
        echo "</SCRIPT>";
      }
	  else
      {
        $_SESSION["rcep_staff_no"] = $staff_no;
        $_SESSION["rcep_enquiry_date"] = $enquiry_date;
        $_SESSION["rcep_prod_no"] = $prod_no;
        $_SESSION["rcep_description"] = $description;
        $_SESSION["rcep_quantity"] = $quantity;
        $_SESSION["rcep_reason"] = $reason;
        $_SESSION["rcep_dep_no"] = $dep_no;
        $_SESSION["rcep_customer_name"] = $customer_name;
        $_SESSION["rcep_customer_no"] = $customer_no;
        echo "<SCRIPT language='Javascript'>";
        echo "  window.location.href = 'recordCustomerEnquiryProblem_1confirmDetails.php';";
        echo "</SCRIPT>";
      }
    }
	else if (isset($_SESSION["rcep_staff_no"]))
    {
      unset($_SESSION["rcep_staff_no"]);
      unset($_SESSION["rcep_enquiry_date"]);
      unset($_SESSION["rcep_prod_no"]);
      unset($_SESSION["rcep_description"]);
      unset($_SESSION["rcep_quantity"]);
	  unset($_SESSION["rcep_reason"]);
      unset($_SESSION["rcep_dep_no"]);
      unset($_SESSION["rcep_customer_name"]);
      unset($_SESSION["rcep_customer_no"]);
      showForm();
      echo "<SCRIPT language='Javascript'>";
      echo "  recordCustomerEnquiryProblem.staff_no.value='';";
      echo "  recordCustomerEnquiryProblem.enquiry_date.value='';";
      echo "  recordCustomerEnquiryProblem.prod_no.value='';";
      echo "  recordCustomerEnquiryProblem.description.value='';";
      echo "  recordCustomerEnquiryProblem.quantity.value='';";
	  echo "  recordCustomerEnquiryProblem.reason.options.selectedIndex=0;";
      echo "  recordCustomerEnquiryProblem.dep_no.options.selectedIndex=0;";
      echo "  recordCustomerEnquiryProblem.customer_name.value='';";
      echo "  recordCustomerEnquiryProblem.customer_no.value='';";
      echo "</SCRIPT>";
    }
	else
    {
      showForm();
    }
    include "$footer";
  }
  else
  {
    session_destroy();
    echo "<SCRIPT language='Javascript'>";
    echo "  parent.window.location.href = 'index.php';";
    echo "</SCRIPT>";
  }

  function showForm()
  {

?>
<b>RECORD A CUSTOMER ENQUIRY PROBLEM</b>
<p>
<font color="red">*</font><font face="Century Gothic" style="font-size:12px"> = mandatory field</font>
<p>

<FORM name="recordCustomerEnquiryProblem" action="" method="post">
<TABLE class="recordCustomerEnquiryProblem" align="center" cellspacing="5" cellpadding="5">
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Product Number</b><font color="red">*</font></span>
	</TD>
    <TD class="rcepDetails" align="left">
	  <input type="text" class="recordCustomerEnquiryProblem" name="prod_no" style="font-family:'Century Gothic'; font-size:12px; width:200px;" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Item Description</b><font color="red">*</font></span>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="description" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Quantity</b><font color="red">*</font></span>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="quantity" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Reason for Non-supply</b><font color="red">*</font></span>
	</TD>
    <TD class="rcepDetails">
	  <select class="recordCustomerEnquiryProblem" name="reason" style="font-family:'Century Gothic'; font-size:12px; width:200px;">
        <option></option>
	    <option>Out of Stock</option>
		<option>Price</option>
		<option>Not a Stocked Item</option>
	  </select>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Department</b><font color="red">*</font></span>
	</TD>
    <TD class="rcepDetails">
	  <select class="recordCustomerEnquiryProblem" name="dep_no" style="font-family:'Century Gothic'; font-size:12px; width:200px;">
        <option></option>
	    <option value ="98054">Ladieswear</option>
		<option value ="89102">Home/Garden</option>
		<option value ="82601">Mail Order</option>
		<option value ="85904">Menswear</option>
	    <option value ="91233">Kitchenware</option>
		<option value ="90342">Appliances/Entertainment</option>
		<option value ="97033">Children's Wear/Toys</option>
		<option value ="95002">Home Decoration</option>
	  </select>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Customer Details Supplied</b><font color="red">*</font></span>
	</TD>
    <TD class="rcepDetails">
	  <select class="recordCustomerEnquiryProblem" name="customer_details_supplied" style="font-family:'Century Gothic'; font-size:12px; width:70px;">
        <option></option>
	    <option>Yes</option>
		<option>No</option>
	  </select>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Registered Customer Name</b><font color="red">*</font></span>
	</TD>
    <TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="customer_name" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>or I.D.</b><font color="red">*</font></span>
	</TD>
    <TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="customer_no" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Other:</b></span>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Name</b></span>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="other_name" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Address</b></span>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="address" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Form completed by:</b></span>
	</TD>
  </TR>
    <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Staff Member I.D.</b><font color="red">*</font></span>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="staff_no" style="font-family:'Century Gothic'; font-size:12px; width:200px" />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField" align="right">
      <span class="style3"><b>Date:</b></span>
	</TD>
	<TD class="rcepDetails">
        <select class="recordCustomerEnquiryProblem" name="enquiry_date_day" style="font-family:'Century Gothic'; font-size:12px; width:50px;">
          <option value ="01">1</option>
          <option value ="02">2</option>
          <option value ="03">3</option>
          <option value ="04">4</option>
          <option value ="05">5</option>
          <option value ="06">6</option>
          <option value ="07">7</option>
          <option value ="08">8</option>
          <option value ="09">9</option>
          <option value ="10">10</option>
          <option value ="11">11</option>
          <option value ="12">12</option>
          <option value ="13">13</option>
          <option value ="14">14</option>
          <option value ="15">15</option>
          <option value ="16">16</option>
          <option value ="17">17</option>
          <option value ="18">18</option>
          <option value ="19">19</option>
          <option value ="20">20</option>
          <option value ="21">21</option>
          <option value ="22">22</option>
          <option value ="23">23</option>
          <option value ="24">24</option>
          <option value ="25">25</option>
          <option value ="26">26</option>
          <option value ="27">27</option>
          <option value ="28">28</option>
          <option value ="29">29</option>
          <option value ="30">30</option>
          <option value ="31">31</option>
        </select>
        <select class="recordCustomerEnquiryProblem" name="enquiry_date_month" style="font-family:'Century Gothic'; font-size:12px; width:100px">
          <option value ="01">January</option>
          <option value ="02">February</option>
          <option value ="03">March</option>
          <option value ="04">April</option>
          <option value ="05">May</option>
          <option value ="06">June</option>
          <option value ="07">July</option>
          <option value ="08">August</option>
          <option value ="09">September</option>
          <option value ="10">October</option>
          <option value ="11">November</option>
          <option value ="12">December</option>
        </select>
        <select class="recordCustomerEnquiryProblem" name="enquiry_date_year" style="font-family:'Century Gothic'; font-size:12px; width:75px">
		  <option value ="2008">2008</option>
		  <option value ="2007">2007</option>
          <option value ="2006">2006</option>
		  <option value ="2005">2005</option>
		  <option value ="2004">2004</option>
		  <option value ="2003">2003</option>
		  <option value ="2002">2002</option>
		  <option value ="2001">2001</option>
		  <option value ="2000">2000</option>
		  <option value ="1999">1999</option>
		  <option value ="1998">1998</option>
		  <option value ="1997">1997</option>
		  <option value ="1996">1996</option>
		  <option value ="1995">1995</option>
		  <option value ="1994">1994</option>
		  <option value ="1993">1993</option>
		  <option value ="1992">1992</option>
		  <option value ="1991">1991</option>
          <option value ="1990">1990</option>
        </select>
      </td>
    </tr>
	</TD>
  </TR>
</TABLE>

<p>

<input class="submit_off" type="reset" value="Reset" name="reset" onmouseover="className='submit_on'" onmouseout="className='submit_off'" />
&nbsp;&nbsp;
<input class="submit_off" type="submit" value="Submit" name="submit" onmouseover="className='submit_on'" onmouseout="className='submit_off'" />

</FORM>

</CENTER>

</BODY>

<?php
  }
  include "$footer";
  
?>